<template>
  <BasicDrawer v-bind="$attrs" @register="registerDrawer" title="推送详情信息" width="700px">
    <Description @register="registerDescription" :data="detailData" />
  </BasicDrawer>

</template>
<script lang="ts" setup>
import { ref, computed, unref, onUnmounted, onMounted } from 'vue';
import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
import { pushDetailSchema } from './history.data';
import { getMsgHistory } from './history.api';
import { Description, useDescription } from '/@/components/Description/index';
const detailData = ref({});

const tenantId = ref()
const emit = defineEmits(['success', 'register'])
const [registerDescription] = useDescription({
  column: 2,
  bordered: false,
  // data: mockData,
  schema: pushDetailSchema,
  labelStyle: {
    marginLeft: '10px',
  }
});

onUnmounted(() => {
  console.log('========> onUnmounted');
})

onMounted(() => {
  console.log('========> onMounted');
})

const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
  setDrawerProps({ confirmLoading: false });
  console.log("record: ", data.record);
  detailData.value = await getMsgHistory({ id: data.record.id, tenantId: data.record.tenantId })
});

</script>
